<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

/**
 * App\Nav
 *
 * @property int $id
 * @property int|null $group_id
 * @property string|null $name
 * @property string|null $link
 * @property string|null $icon
 * @property int|null $type 1文章链接2栏目链接3url链接
 * @property \Carbon\Carbon|null $created_at
 * @property \Carbon\Carbon|null $updated_at
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Nav whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Nav whereGroupId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Nav whereIcon($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Nav whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Nav whereLink($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Nav whereName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Nav whereType($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Nav whereUpdatedAt($value)
 * @mixin \Eloquent
 */
class Nav extends Model
{
    //
    protected $table = 'nav';
    public static function getMenu($name){
        $group_id = NavGroup::where('name',$name)->first();
        $list = self::where('group_id',$group_id->id)->get();
        if($list){
            return $list->toArray();
        }
    }
}
